package com.gitee.mrj.aiboot.annotation.config.sf.ui.widget;

import com.gitee.mrj.aiboot.annotation.config.KV;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
@Documented
public @interface SFDateWidget {
    Mode mode() default Mode.DATE;

    DatePickerSize size() default DatePickerSize.DEFAULT;

    String placeholder() default "";

    /**
     * Inline mode of the date picker
     * <p>
     * 内联模式
     */
    boolean inline() default false;

    /**
     * **Just only support date-fns**
     * <p>
     * Return the formatted date string in the given format, [Accepted tokens](https://date-fns.org/v2.12.0/docs/format), like this:
     * - `yyyy-MM-dd HH:mm:ss` Date time
     * - `t` Seconds timestamp
     * - `T` Milliseconds timestamp
     */
    String format() default "";

    /**
     * To set the date format (equar [nzFormat](https://ng.ant.design/components/date-picker/zh#api))
     * <p>
     * **TIPS** [nzFormat special instructions](https://ng.ant.design/components/date-picker/en#api)
     */
    String displayFormat() default "";

    /**
     * The end value corresponding to the date range `key`, a date range [demo](https://ng-alain.com/form/date/en#form-date-range).
     */
    String end() default "";

    /**
     * Whether to show clear button, default: `true`
     */
    boolean allowClear() default true;

    /**
     * Picker className
     */
    String className() default "";


    /**
     * To customize the style of the popup calendar
     */
    KV[] popupStyle() default {};

    /**
     * To customize the className of the popup calendar
     */
    String dropdownClassName() default "";

    /**
     * Set picker mode of range picker, default: `date`
     */
    RangeMode rangeMode() default RangeMode.DATE;


    /**
     * Render extra footer in panel, support components: `nz-date-picker`, `nz-range-picker`, `nz-year-picker`, `nz-month-picker`
     */
    String renderExtraFooter() default "";

    /**
     * To provide an additional time selection
     */
    boolean showTime() default false;

    /**
     * Whether to show "Today" button, default: `true`
     */
    boolean showToday() default true;

    /**
     * Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices), default: `false`
     */
    boolean inputReadOnly() default false;

    public enum Mode {
        DATE("date"),
        WEEK("week"),
        MONTH("month"),
        YEAR("year"),
        RANGE("range");

        private final String mode;

        Mode(String mode) {
            this.mode = mode;
        }

        public String mode() {
            return this.mode;
        }
    }

    public enum RangeMode {
        DATE("date"),
        WEEK("week"),
        MONTH("month"),
        YEAR("year");

        private final String mode;

        RangeMode(String mode) {
            this.mode = mode;
        }

        public String value() {
            return this.mode;
        }
    }

    public enum DatePickerSize {
        LARGE("large"),
        DEFAULT("default"),
        SMALL("small");

        private String size;

        DatePickerSize(String size) {
            this.size = size;
        }

        public String value() {
            return this.size;
        }
    }
}
